import { createSlice } from '@reduxjs/toolkit'

interface InitialState {
  pieData: pieDataInterFace[]
}

export interface pieDataInterFace {
  name: string
  value: number
}

const initialState: InitialState = {
  pieData: []
}

const useEchartReducer = createSlice({
  name: 'echarts',
  initialState,
  reducers: {
    // 修改pieData
    changePieData(state, action) {
      state.pieData = action.payload
    }
  }
})

export const { changePieData } = useEchartReducer.actions

export default useEchartReducer.reducer
